﻿@model EnetaMvc.ApplicationServices.Dto.FullProfileDto

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_ProfileLayout.cshtml";
}
<div class="content-txt">

	<!--blog-head start-->
	<div class="blog-head">
		<div class="user-foto"> <a href="@Request.Url"><img alt="image" src="@Html.GetProfileUrl(Model.Id)" width="32" height="32" /></a> </div>
		<h2><a href="@Request.Url">@Model.UserName</a></h2>
		<!--profile-nav start-->
        @if(User.IsInRole("User") || User.IsInRole("Administrator"))
        {
		    <ul id="profilenav">
			    <li> <span class="open-submenu">&nbsp;</span> <a href="#">Lisa raamat</a>
				    <div>
					    <ul>
						    <li><a href="#">Lisa uudis</a></li>
						    <li><a href="#">Lisa ajakiri</a></li>
						    <li><a href="#">Lisa firma</a></li>
						    <li><a href="#">Lisa blogi</a></li>
					    </ul>
				    </div>
			    </li>
		    </ul>
        }
		<!--profile-nav end-->
	</div>
	<!--blog-head end-||-content-info-area start-->
    <div class="content-info-area">
        <h3 id="ctl00_ctl12_g_ef1a7810_633c_4acc_9385_b7f47f7daf9d_ctl00_youTitle">@Model.UserName</h3>
        @Html.ValidationSummary(true)
        <div class="enter-information">
            <fieldset>
                <div class="input-holder profile">
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.UserName</h5>
                        </div>
                        <div class="information-main">
                            <span>@Model.UserName</span>
                        </div>
                    </div>
                    @if (Model.ShowFirstName)
                    {
                        <div class="info-row">
                            <div class="title">
                                <h5>@Resources.EnetaMvc.FirstName</h5>
                            </div>
                            <div class="information-main">
                                <span>@Model.FirstName</span>
                            </div>
                        </div>
                    }
                    @if (Model.ShowLastName)
                    {
                        <div class="info-row">
                            <div class="title">
                                <h5>@Resources.EnetaMvc.LastName</h5>
                            </div>
                            <div class="information-main">
                                <span>@Model.LastName</span>
                            </div>
                        </div>
                    }
                    @if (Model.ShowEmail && !string.IsNullOrEmpty(Model.Email))
                    { 
                        <div class="info-row">
                            <div class="title">
                                <h5>@Resources.EnetaMvc.EmailAddress</h5>
                            </div>
                            <div class="information-main">
                                <span><a href="mailto:@Model.Email">@Model.Email</a></span>
                            </div>
                        </div>
                    }
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.MyRoles</h5>
                        </div>
                        <div class="information-main">
                            <span>@string.Join(", ", Model.MyRoles.Select(r => r.Name).ToArray())</span>
                        </div>
                    </div>
                </div>
            </fieldset>

            @if (Model.CanShowDescriptionBlock())
            {
            <fieldset>
                <div class="input-holder profile">
                @if (Model.CanShowDescription())
                {
                <div class="info-row">
                    <div class="title">
                        <h5>@Resources.EnetaMvc.AboutMe</h5>
                    </div>
                    <div class="information-main">
                        <span>@Model.Description</span>
                    </div>
                </div>
                }
                @if (Model.CanShowHomePage())
                {
                <div class="info-row">
                    <div class="title">
                        <h5>@Resources.EnetaMvc.HomePage</h5>
                    </div>
                    <div class="information-main">
                        <span><a href="@Model.HomePage">@Model.HomePage</a></span>
                    </div>
                </div>  
                } 
                </div>
            </fieldset>
            }
        
            @if (Model.CanShowEducationBlock())
            { 
            <fieldset>
                <div class="input-holder profile">
                @if (Model.CanShowSchool())
                { 
                <div class="info-row">
                    <div class="title">
                        <h5>@Resources.EnetaMvc.School</h5>
                    </div>
                    <div class="information-main">
                        <span>@Model.School</span>
                    </div>
                </div>                 
                }
                @if (Model.CanShowFieldOfStudy())
                { 
                <div class="info-row">
                    <div class="title">
                        <h5>@Resources.EnetaMvc.FieldOfStudy</h5>
                    </div>
                    <div class="information-main">
                        <span>@Model.FieldOfStudy</span>
                    </div>
                </div>                 
                }
                </div>
            </fieldset>           
            }
        
            @if (Model.CanShowJobBlock())
            { 
            <fieldset>
                <div class="input-holder profile">
                @if (Model.CanShowCompany())
                { 
                <div class="info-row">
                    <div class="title">
                        <h5>@Resources.EnetaMvc.Company</h5>
                    </div>
                    <div class="information-main">
                        <span>@Model.Company</span>
                    </div>
                </div>                 
                }
                @if (Model.CanShowJobTitle())
                { 
                <div class="info-row">
                    <div class="title">
                        <h5>@Resources.EnetaMvc.JobTitle</h5>
                    </div>
                    <div class="information-main">
                        <span>@Model.JobTitle</span>
                    </div>
                </div>                 
                }
                </div>
            </fieldset>
            }
        
            <fieldset>            
                <div class="commandContainer">
                    @if (Model.CanEditProfile())
                    {
                        <form action="@Url.Action("Edit", new { id = Model.Id })" method="get">
                            <input type="submit" value="@Resources.EnetaMvc.Edit" class="fixSmallButton" />
                        </form>
                    }
                    @if (Model.Locked && User.IsInRole("Administrator"))
                    {
	                    <form action="@Url.Action("Unlock", new { id = Model.Id })" method="post">
                            <input type="submit" value="@Resources.EnetaMvc.Unlock" class="fixSmallButton" />
                        </form>
                    }
                    else if(User.IsInRole("Administrator"))
                    { 
	                    <form action="@Url.Action("Lock", new { id = Model.Id })" method="post">
                            <input type="submit" value="@Resources.EnetaMvc.Lock" class="fixSmallButton" />
                        </form>                
                    }
                    <div class="fixLastChanged">
                        @Resources.EnetaMvc.LastChanged
                        <span>@Model.Modified.ToShortDateString()</span>
                    </div>
                </div>
            </fieldset>

            @if(Model.Blogs.Count > 0)
            {
                <h3>@Resources.EnetaMvc.Blogs</h3>
            }
            @foreach(var blog in Model.Blogs)
            {
            <fieldset>
                <form action="@Url.Content("~/profiles/BlogCommandAction/" +  blog.Id)" method="get">
                <div class="input-holder">
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.BlogName</h5>
                        </div>
                        <div class="information-main">
                            <span>@blog.Name</span>
                                @if (blog.PublishingStateId == 1)
                                { 
                                    <span style="color:green; font-style: italic">@Resources.EnetaMvc.Approved</span>
                                }
                                @if (blog.PublishingStateId == 2)
                                { 
                                    <span style="color:#FFCC00; font-style: italic">@Resources.EnetaMvc.Pending</span>
                                }
                                @if (blog.PublishingStateId == 3)
                                { 
                                    <span style="color:red; font-style: italic">@Resources.EnetaMvc.Rejected</span>
                                }
                                @if (!string.IsNullOrEmpty(blog.PublishingStateComment))
                                { 
                                    <span style="clear: both; float:left"><em>(@blog.PublishingStateComment)</em></span>
                                }
                        </div>
                    </div>
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.BlogUrl</h5>
                        </div>
                        <div class="information-main">
                            <span><a href="@blog.Url">@blog.Url</a></span>
                        </div>
                    </div>
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.BlogRssUrl</h5>
                        </div>
                        <div class="information-main">
                            <span><a href="@blog.RssUrl">@blog.RssUrl</a></span>
                        </div>
                    </div>
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.BlogDescription</h5>
                            <a></a>
                        </div>
                        <div class="information-main">
                            <span>@blog.Description</span>
                        </div>
                    </div>
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.BlogFirstPostDate</h5>
                            <a></a>
                        </div>
                        <div class="information-main">
                            <span>@blog.FirstPostDate.ToShortDateString()</span>
                        </div>
                    </div>
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.Modified</h5>
                            <a></a>
                        </div>
                        <div class="information-main">
                            <span></span>
                        </div>
                    </div>
                    @if(User.IsInRole("Administrator"))
                    {
                    <div class="info-row">
                        <div class="title">
                            <h5>@Resources.EnetaMvc.ReasonOfRejection</h5>
                            <a></a>
                        </div>
                        <div class="information-main">
                             @Html.TextArea("Comment", new {cols = 12, rows = 15, id = "Comment"})
                        </div>
                    </div>
                    }
                </div>
                <div class="commandContainer">
                    <input type="submit" name="CommandName" value="@Resources.EnetaMvc.Edit" class="fixSmallButton" />
                    @if(User.IsInRole("Administrator"))
                    {
                        <input type="submit" name="CommandName" value="@Resources.EnetaMvc.Reject" class="fixSmallButton" />
                        <input type="submit" name="CommandName" value="@Resources.EnetaMvc.Approve" class="fixSmallButton" />
                    }
                </div>
                </form>
            </fieldset>
            <span>&nbsp;</span>
            }

            @if(Model.EventAttendings.Count > 0)
            {
                <h3>@Resources.EnetaMvc.Events</h3>
                <fieldset>
                    <div class="input-holder">
                    @foreach (var attending in Model.EventAttendings)
                    {
                        <div class="info-row">
                          <div class="title">
                            <h5>@attending.EventStartDate.ToShortDateString()</h5>
                          </div>
                          <div class="information-main">
                            <span>
                              <a href="@Url.Content("~/events/details/" + attending.EventId)">@attending.EventTitle</a>
                            </span>
                          </div>
                        </div>
                    }
                    </div>
                </fieldset>
            }
        </div>
    </div>
</div>